package megamu.mesh;

import java.util.ArrayList;

import com.jellyfishumbrella.GL.RendererGL;
import com.jellyfishumbrella.GL.Surface;
import com.jellyfishumbrella.GL.Vector3d;
import com.jellyfishumbrella.GL.Vertex;

public class Corner {// extends Vertex {
	// public Surface surface = RendererGL.surfaceHash.get("default");
	public Vertex				vert	= new Vertex();
	public ArrayList<Region>	regions;
	public ArrayList<Corner>	neighbors;
	public boolean				checked	= false;

	public Corner(double X, double Y, double Z) {
		// super(X, Y, Z);
		vert = new Vertex(X, Y, Z);
		regions = new ArrayList<Region>();
		neighbors = new ArrayList<Corner>();
	}

	public Corner(Vector3d currVert0) {
		vert = new Vertex(currVert0);
		regions = new ArrayList<Region>();
		neighbors = new ArrayList<Corner>();
	}

	/*
	 * public Corner(double X, double Y, double Z, Surface surface) { //super(X, Y, Z); //this.surface = surface; pos = new Vertex(X,Y,Z); regions = new ArrayList<Region>(); neighbors = new ArrayList<Corner>(); }
	 */
	public void addRegion(Region addMe) {
		if (!regions.contains(addMe)) {
			regions.add(addMe);
		}
	}

	public String toString() {
		return vert.toString();
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((vert == null) ? 0 : vert.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Corner other = (Corner) obj;
		if (vert == null) {
			if (other.vert != null)
				return false;
		} else if (!vert.equals(other.vert))
			return false;
		return true;
	}
}
